<?php
	ob_start();
	$page='';
	if(isset($_GET['page']))
		$page =$_GET['page'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 
	<head>
		
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		
		<title>Thietbicachdien.com</title>
		
		<!--                       CSS                       -->
	  
		<!-- Reset Stylesheet -->
		<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
	  
		<!-- Main Stylesheet -->
		<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
		
		<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
		<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />	
		
		<!-- Colour Schemes
	  
		Default colour scheme is green. Uncomment prefered stylesheet to use it.
		
		<link rel="stylesheet" href="resources/css/blue.css" type="text/css" media="screen" />
		
		<link rel="stylesheet" href="resources/css/red.css" type="text/css" media="screen" />  
	 
		-->
		
		<!-- Internet Explorer Fixes Stylesheet -->
		
		<!--[if lte IE 7]>
			<link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
		<![endif]-->
		
		<!--                       Javascripts                       -->
	  
		<!-- jQuery -->
		<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
		
		<!-- jQuery Configuration -->
		<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
		
		<!-- Facebox jQuery Plugin -->
		<script type="text/javascript" src="resources/scripts/facebox.js"></script>
        <script type="text/javascript" src="resources/scripts/js.js"></script>
		
		<!-- jQuery WYSIWYG Plugin -->
		<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
		
		<!-- Internet Explorer .png-fix -->
		
		<!--[if IE 6]>
			<script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
			<script type="text/javascript">
				DD_belatedPNG.fix('.png_bg, img, li');
			</script>
		<![endif]-->
		
	</head>
  
	<body id="login">
		
		<div id="login-wrapper" class="png_bg">
			<div id="login-top">
								<!-- Logo (221px width) -->
				<img id="logo" src="../images/banner.png" alt="Viettech.com" class="anhlogin"/>
			</div> <!-- End #logn-top -->
			
			<div id="login-content">
          		<?php
					//session_start();
                	$txt_username='';$txt_pass='';$hide_show=1;$err=0;
					if(isset($_POST['txt_username'])) 
					{	
						$txt_username=$_POST['txt_username'];
						$hide_show=0;
					}
					if(isset($_POST['txt_pass']))
					{
						$txt_pass=md5($_POST['txt_pass']);
					}
					if($hide_show==1)
					{
				
                }
				else
				{
					$sql='SELECT * FROM tbl_nguoidung WHERE username="'.$txt_username.'" AND pass = "'.$txt_pass.'"';
					
					//Thuc thi cau lenh SQL
					$result=mysql_query($sql);
					if(mysql_num_rows($result)==0)
					{
						$err=1;
					}else
						{
							$_SESSION['username']=$txt_username;
							$_SESSION['pass']=$txt_pass;
							header("location: index.php");
						}
						
				}
				?>
				<form name="frmlogin" action="index.php?page=login" method="post" onsubmit="return checkForm()">
				
					<div class="notification information png_bg">
                    <?php
                    	if($err==1)
						{
							echo '<div>Mật khẩu hoặc tài khoản không đúng!</div>';
						}
					?>
					</div>
					
					<p>
						<label for="txt_username">Username</label>
						<input class="text-input" type="text" name="txt_username" id="txt_username"/><div id="user_err" style="color:red;"></div><br/>
					</p>
					<div class="clear"></div>
					<p>
						<label for="txt_pass">Password</label>
						<input class="text-input" type="password" name="txt_pass" id="txt_pass"/>
					</p>
					<div class="clear"></div>
					<p id="remember-password">
						<input type="checkbox" />Remember me
					</p>
					<div class="clear"></div>
					<p>
						<input class="button" type="submit" value="Sign In" />
					</p>
					
				</form>
                
			</div> <!-- End #login-content -->
			
		</div> <!-- End #login-wrapper -->
		
  </body>
  
</html>
